package com.baizhi.action;

import com.baizhi.entity.Area;
import com.baizhi.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@Scope("prototype")
public class AreaAction {
    private AreaService areaService;
    @Autowired
    public void setAreaService(AreaService areaService) {
        this.areaService = areaService;
    }
    private Map<String,Object> map = new HashMap<>();

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }
    private String cityid;

    public String getCityid() {
        return cityid;
    }

    public void setCityid(String cityid) {
        this.cityid = cityid;
    }
    public String showAreas(){
        System.out.println(33333);
        List<Area> areas = areaService.selectByCityid(cityid);
        map.put("list",areas);
        return "ok";
    }
}
